unit Class_GZJG_FL;

interface
uses
  Classes,SysUtils,Uni,UniEngine;

type
  TGZJGFL=class(TUniEngine)
  private
    FUNITLINK: string;           
    FGZJGIDEX: Integer;
    FGZJGFLID: Integer;
    FGZJGFLBH: Integer;
    FGZJGFLMC: string;
    FGZJGFLLX: Integer;
    FGZJGWGFL: Integer;
    FGZJGFLWS: Integer;
    FGZJGFLJS: Integer;
    FGZJGFLLJ: Integer;
    FGZJGFLGQ: Integer;
    FGZJGFLKD: Integer;
    FGZJGFLDQ: Integer;
    FPREVFLID: Integer;
    FNODELEVL: Integer;
    FFORTOTAL: Integer;
    FFORMINUS: Integer;
    FTOTLTYPE: Integer;
    FISITERAT: Integer;
  protected
    procedure SetParameters;override;
    function  GetStrInsert:string;override;
    function  GetStrUpdate:string;override;
    function  GetStrDelete:string;override;
  public
    function  GetStrsIndex:string;override;
  public
    function  GetNextIdex:Integer;overload;
    function  GetNextIdex(AUniConnection:TUniConnection):Integer;overload;
  public
    function  CheckExist(AUniConnection:TUniConnection):Boolean;override;
  public
    destructor  Destroy; override;
    constructor Create;  
  published
    property UNITLINK: string read FUNITLINK write FUNITLINK;
    property GZJGIDEX: Integer read FGZJGIDEX write FGZJGIDEX;
    property GZJGFLID: Integer read FGZJGFLID write FGZJGFLID;
    property GZJGFLBH: Integer read FGZJGFLBH write FGZJGFLBH;
    property GZJGFLMC: string read FGZJGFLMC write FGZJGFLMC;
    property GZJGFLLX: Integer read FGZJGFLLX write FGZJGFLLX;
    property GZJGWGFL: Integer read FGZJGWGFL write FGZJGWGFL;
    property GZJGFLWS: Integer read FGZJGFLWS write FGZJGFLWS;
    property GZJGFLJS: Integer read FGZJGFLJS write FGZJGFLJS;
    property GZJGFLLJ: Integer read FGZJGFLLJ write FGZJGFLLJ;
    property GZJGFLGQ: Integer read FGZJGFLGQ write FGZJGFLGQ;
    property GZJGFLKD: Integer read FGZJGFLKD write FGZJGFLKD;
    property GZJGFLDQ: Integer read FGZJGFLDQ write FGZJGFLDQ;
    property PREVFLID: Integer read FPREVFLID write FPREVFLID;
    property NODELEVL: Integer read FNODELEVL write FNODELEVL;
    property FORTOTAL: Integer read FFORTOTAL write FFORTOTAL;
    property FORMINUS: Integer read FFORMINUS write FFORMINUS;
    property TOTLTYPE: Integer read FTOTLTYPE write FTOTLTYPE;
    property ISITERAT: Integer read FISITERAT write FISITERAT;    
  public
    class function  ReadDS(AUniQuery:TUniQuery):TUniEngine;override;
    class procedure ReadDS(AUniQuery:TUniQuery;var Result:TUniEngine);override;
    class function  CopyIt(AGZJGFL:TGZJGFL):TGZJGFL;overload;        
    class procedure CopyIt(AGZJGFL:TGZJGFL;var Result:TGZJGFL);overload;       
  end;

implementation

{ TGZJGFL }
procedure TGZJGFL.SetParameters;
begin
  inherited;
  with FUniSQL.Params do
  begin
    case FOptTyp of
      otAddx:
      begin
        ParamByName('UNIT_LINK').Value := UNITLINK;
        ParamByName('GZJG_IDEX').Value := GZJGIDEX;
        ParamByName('GZJG_FLID').Value := GZJGFLID;
        ParamByName('GZJG_FLBH').Value := GZJGFLBH;
        ParamByName('GZJG_FLMC').Value := GZJGFLMC;
        ParamByName('GZJG_FLLX').Value := GZJGFLLX;
        ParamByName('GZJG_WGFL').Value := GZJGWGFL;
        ParamByName('GZJG_FLWS').Value := GZJGFLWS;
        ParamByName('GZJG_FLJS').Value := GZJGFLJS;
        ParamByName('GZJG_FLLJ').Value := GZJGFLLJ;
        ParamByName('GZJG_FLGQ').Value := GZJGFLGQ;
        ParamByName('GZJG_FLKD').Value := GZJGFLKD;
        ParamByName('GZJG_FLDQ').Value := GZJGFLDQ;
        ParamByName('PREV_FLID').Value := PREVFLID;
        ParamByName('NODE_LEVL').Value := NODELEVL;
        ParamByName('FOR_TOTAL').Value := FORTOTAL;
        ParamByName('FOR_MINUS').Value := FORMINUS;
        ParamByName('TOTL_TYPE').Value := TOTLTYPE;
        ParamByName('IS_ITERAT').Value := ISITERAT; 
      end;
      otEdit:
      begin
        ParamByName('UNIT_LINK').Value := UNITLINK;
        ParamByName('GZJG_IDEX').Value := GZJGIDEX;
        ParamByName('GZJG_FLID').Value := GZJGFLID;
        ParamByName('GZJG_FLBH').Value := GZJGFLBH;
        ParamByName('GZJG_FLMC').Value := GZJGFLMC;
        ParamByName('GZJG_FLLX').Value := GZJGFLLX;
        ParamByName('GZJG_WGFL').Value := GZJGWGFL;
        ParamByName('GZJG_FLWS').Value := GZJGFLWS;
        ParamByName('GZJG_FLJS').Value := GZJGFLJS;
        ParamByName('GZJG_FLLJ').Value := GZJGFLLJ;
        ParamByName('GZJG_FLGQ').Value := GZJGFLGQ;
        ParamByName('GZJG_FLKD').Value := GZJGFLKD;
        ParamByName('GZJG_FLDQ').Value := GZJGFLDQ;
        ParamByName('PREV_FLID').Value := PREVFLID;
        ParamByName('NODE_LEVL').Value := NODELEVL;
        ParamByName('FOR_TOTAL').Value := FORTOTAL;
        ParamByName('FOR_MINUS').Value := FORMINUS;
        ParamByName('TOTL_TYPE').Value := TOTLTYPE;
        ParamByName('IS_ITERAT').Value := ISITERAT; 
      end;  
      otDelt:
      begin
        ParamByName('UNIT_LINK').Value := UNITLINK;
        ParamByName('GZJG_IDEX').Value := GZJGIDEX;
        ParamByName('GZJG_FLID').Value := GZJGFLID;
 
      end;  
    end;
  end;
end;

function TGZJGFL.CheckExist(AUniConnection: TUniConnection): Boolean;
begin
  Result:=CheckExist('TBL_GZJG_FL',['UNIT_LINK',UNITLINK,'GZJG_IDEX',GZJGIDEX,'GZJG_FLID',GZJGFLID],AUniConnection);
end;

function TGZJGFL.GetNextIdex: Integer;
begin

end;

function TGZJGFL.GetNextIdex(AUniConnection: TUniConnection): Integer;
begin

end;

function TGZJGFL.GetStrDelete: string;
begin
  Result:='DELETE FROM TBL_GZJG_FL WHERE   UNIT_LINK=:UNIT_LINK AND GZJG_IDEX=:GZJG_IDEX AND GZJG_FLID=:GZJG_FLID';
end;

function TGZJGFL.GetStrInsert: string;
begin
  Result:='INSERT INTO TBL_GZJG_FL'
         +'    ( UNIT_LINK, GZJG_IDEX, GZJG_FLID, GZJG_FLBH, GZJG_FLMC'
         +'    , GZJG_FLLX, GZJG_WGFL, GZJG_FLWS, GZJG_FLJS, GZJG_FLLJ'
         +'    , GZJG_FLGQ, GZJG_FLKD, GZJG_FLDQ, PREV_FLID, NODE_LEVL'
         +'    , FOR_TOTAL, FOR_MINUS, TOTL_TYPE, IS_ITERAT)'
         +'    VALUES'
         +'    (:UNIT_LINK,:GZJG_IDEX,:GZJG_FLID,:GZJG_FLBH,:GZJG_FLMC'
         +'    ,:GZJG_FLLX,:GZJG_WGFL,:GZJG_FLWS,:GZJG_FLJS,:GZJG_FLLJ'
         +'    ,:GZJG_FLGQ,:GZJG_FLKD,:GZJG_FLDQ,:PREV_FLID,:NODE_LEVL'
         +'    ,:FOR_TOTAL,:FOR_MINUS,:TOTL_TYPE,:IS_ITERAT)';
end;

function TGZJGFL.GetStrsIndex: string;
begin
  Result:=Format('%S-%D-%D',[UNITLINK,GZJGIDEX,GZJGFLID]);
end;

function TGZJGFL.GetStrUpdate: string;
begin
  Result:='UPDATE  TBL_GZJG_FL SET'
         +'    GZJG_FLBH=:GZJG_FLBH,'
         +'    GZJG_FLMC=:GZJG_FLMC,'
         +'    GZJG_FLLX=:GZJG_FLLX,'
         +'    GZJG_WGFL=:GZJG_WGFL,'
         +'    GZJG_FLWS=:GZJG_FLWS,'
         +'    GZJG_FLJS=:GZJG_FLJS,'
         +'    GZJG_FLLJ=:GZJG_FLLJ,'
         +'    GZJG_FLGQ=:GZJG_FLGQ,'
         +'    GZJG_FLKD=:GZJG_FLKD,'
         +'    GZJG_FLDQ=:GZJG_FLDQ,'
         +'    PREV_FLID=:PREV_FLID,'
         +'    NODE_LEVL=:NODE_LEVL,'
         +'    FOR_TOTAL=:FOR_TOTAL,'
         +'    FOR_MINUS=:FOR_MINUS,'
         +'    TOTL_TYPE=:TOTL_TYPE,'
         +'    IS_ITERAT=:IS_ITERAT'
         +'    WHERE UNIT_LINK=:UNIT_LINK'
         +'    AND   GZJG_IDEX=:GZJG_IDEX'
         +'    AND   GZJG_FLID=:GZJG_FLID';
end;

constructor TGZJGFL.Create;
begin

end;

destructor TGZJGFL.Destroy;
begin

  inherited;
end;

class function TGZJGFL.ReadDS(AUniQuery: TUniQuery): TUniEngine;
begin
  Result:=TGZJGFL.Create;
  with TGZJGFL(Result) do
  begin
    UNITLINK:=AUniQuery.FieldByName('UNIT_LINK').AsString;
    GZJGIDEX:=AUniQuery.FieldByName('GZJG_IDEX').AsInteger;
    GZJGFLID:=AUniQuery.FieldByName('GZJG_FLID').AsInteger;
    GZJGFLBH:=AUniQuery.FieldByName('GZJG_FLBH').AsInteger;
    GZJGFLMC:=AUniQuery.FieldByName('GZJG_FLMC').AsString;
    GZJGFLLX:=AUniQuery.FieldByName('GZJG_FLLX').AsInteger;
    GZJGWGFL:=AUniQuery.FieldByName('GZJG_WGFL').AsInteger;
    GZJGFLWS:=AUniQuery.FieldByName('GZJG_FLWS').AsInteger;
    GZJGFLJS:=AUniQuery.FieldByName('GZJG_FLJS').AsInteger;
    GZJGFLLJ:=AUniQuery.FieldByName('GZJG_FLLJ').AsInteger;
    GZJGFLGQ:=AUniQuery.FieldByName('GZJG_FLGQ').AsInteger;
    GZJGFLKD:=AUniQuery.FieldByName('GZJG_FLKD').AsInteger;
    GZJGFLDQ:=AUniQuery.FieldByName('GZJG_FLDQ').AsInteger;
    PREVFLID:=AUniQuery.FieldByName('PREV_FLID').AsInteger;
    NODELEVL:=AUniQuery.FieldByName('NODE_LEVL').AsInteger;
    FORTOTAL:=AUniQuery.FieldByName('FOR_TOTAL').AsInteger;
    FORMINUS:=AUniQuery.FieldByName('FOR_MINUS').AsInteger;
    TOTLTYPE:=AUniQuery.FieldByName('TOTL_TYPE').AsInteger;
    ISITERAT:=AUniQuery.FieldByName('IS_ITERAT').AsInteger;
  end;  
end;

class procedure TGZJGFL.ReadDS(AUniQuery: TUniQuery; var Result: TUniEngine);
begin
  if Result=nil then Exit;
  with TGZJGFL(Result) do
  begin
    UNITLINK:=AUniQuery.FieldByName('UNIT_LINK').AsString;
    GZJGIDEX:=AUniQuery.FieldByName('GZJG_IDEX').AsInteger;
    GZJGFLID:=AUniQuery.FieldByName('GZJG_FLID').AsInteger;
    GZJGFLBH:=AUniQuery.FieldByName('GZJG_FLBH').AsInteger;
    GZJGFLMC:=AUniQuery.FieldByName('GZJG_FLMC').AsString;
    GZJGFLLX:=AUniQuery.FieldByName('GZJG_FLLX').AsInteger;
    GZJGWGFL:=AUniQuery.FieldByName('GZJG_WGFL').AsInteger;
    GZJGFLWS:=AUniQuery.FieldByName('GZJG_FLWS').AsInteger;
    GZJGFLJS:=AUniQuery.FieldByName('GZJG_FLJS').AsInteger;
    GZJGFLLJ:=AUniQuery.FieldByName('GZJG_FLLJ').AsInteger;
    GZJGFLGQ:=AUniQuery.FieldByName('GZJG_FLGQ').AsInteger;
    GZJGFLKD:=AUniQuery.FieldByName('GZJG_FLKD').AsInteger;
    GZJGFLDQ:=AUniQuery.FieldByName('GZJG_FLDQ').AsInteger;
    PREVFLID:=AUniQuery.FieldByName('PREV_FLID').AsInteger;
    NODELEVL:=AUniQuery.FieldByName('NODE_LEVL').AsInteger;
    FORTOTAL:=AUniQuery.FieldByName('FOR_TOTAL').AsInteger;
    FORMINUS:=AUniQuery.FieldByName('FOR_MINUS').AsInteger;
    TOTLTYPE:=AUniQuery.FieldByName('TOTL_TYPE').AsInteger;
    ISITERAT:=AUniQuery.FieldByName('IS_ITERAT').AsInteger;
  end;  
end;

class function  TGZJGFL.CopyIt(AGZJGFL: TGZJGFL): TGZJGFL;
begin
  Result:=TGZJGFL.Create;
  TGZJGFL.CopyIt(AGZJGFL,Result)
end;

class procedure TGZJGFL.CopyIt(AGZJGFL:TGZJGFL;var Result:TGZJGFL);
begin
  if Result=nil then Exit;
  Result.UNITLINK:=AGZJGFL.UNITLINK;
  Result.GZJGIDEX:=AGZJGFL.GZJGIDEX;
  Result.GZJGFLID:=AGZJGFL.GZJGFLID;
  Result.GZJGFLBH:=AGZJGFL.GZJGFLBH;
  Result.GZJGFLMC:=AGZJGFL.GZJGFLMC;
  Result.GZJGFLLX:=AGZJGFL.GZJGFLLX;
  Result.GZJGWGFL:=AGZJGFL.GZJGWGFL;
  Result.GZJGFLWS:=AGZJGFL.GZJGFLWS;
  Result.GZJGFLJS:=AGZJGFL.GZJGFLJS;
  Result.GZJGFLLJ:=AGZJGFL.GZJGFLLJ;
  Result.GZJGFLGQ:=AGZJGFL.GZJGFLGQ;
  Result.GZJGFLKD:=AGZJGFL.GZJGFLKD;
  Result.GZJGFLDQ:=AGZJGFL.GZJGFLDQ;
  Result.PREVFLID:=AGZJGFL.PREVFLID;
  Result.NODELEVL:=AGZJGFL.NODELEVL;
  Result.FORTOTAL:=AGZJGFL.FORTOTAL;
  Result.FORMINUS:=AGZJGFL.FORMINUS;
  Result.TOTLTYPE:=AGZJGFL.TOTLTYPE;
  Result.ISITERAT:=AGZJGFL.ISITERAT;
end;

end.

